﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace MockPrjTeam2.Common
{
    public static class AppConfig
    {
        static AppConfig()
        {
        }

        public static string ConnectionString()
        {
          return  ConfigurationManager.ConnectionStrings["AbServiceDirectoryConnectionString"].ConnectionString;
        }
 
        public static SqlConnection OpenConnection()
        {
            string connectString = ConnectionString();

            var connection = new SqlConnection(connectString);

            if (connection.State == ConnectionState.Closed || connection.State == ConnectionState.Broken)
            {
                connection.Open();
            }

            return connection;
        }
    }
}